<%@ page language="java" import="java.util.*" import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html" />
	<meta name="author" content="blog.anchen8.net" />
	<title>毕业生，你的选择</title>
    <link rel="stylesheet" type="text/css" href="../css/photo.css" />
    <script src="../js/jQuery1.82.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/photo.js"></script>
    <script>
    function createMain(){
        var _scrollWidth=Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
        var _scrollHeight=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
            document.getElementById("main").style.left=(_scrollWidth-950)/2+"px";
           // document.getElementById("m").style.height=_scrollHeight+"px";
    }
    function naviover(val){
        document.getElementById(val).style.backgroundColor="#E1DACF";
    }
    function naviout(val){
        document.getElementById(val).style.backgroundColor="#C5C5C5";
    }
    $(document).ready(function() {
		/*	2nd example	*/
		
		$("#menu2 li a").wrapInner( '<span class="out"></span>' );
		
		$("#menu2 li a").each(function() {
			$( '<span class="over">' +  $(this).text() + '</span>' ).appendTo( this );
		});

		$("#menu2 li a").hover(function() {
			$(".out",	this).stop().animate({'top':	'45px'},	200); // move down - hide
			$(".over",	this).stop().animate({'top':	'0px'},		200); // move down - show

		}, function() {
			$(".out",	this).stop().animate({'top':	'0px'},		200); // move up - show
			$(".over",	this).stop().animate({'top':	'-45px'},	200); // move up - hide
		});

	});
    </script>
</head>

<body class="body">
	<jsp:useBean id="sql" scope="page" class="com.tzq.JAVABEAN.ConnectDB"></jsp:useBean>	
<%
String selectImageAlbumSql = "select top 8 * from ImageAlbum,Userinfo,Schools where ImageAlbum.UserID= Userinfo.UserID and Userinfo.SchoolID=Schools.SchoolID order by ClickTimes DESC";
ResultSet rsImageAlbum = sql.executeQuery(selectImageAlbumSql);
%>
    <div class="main" id="main"> 
        <div class="search">
            <div class="logophoto" id="logophoto" onmouseover="logohover()" onmouseout="logoout()">
                <img src="/Bys-Website/SourceImageFile/photologo.jpg"/>
            </div>
            <div class="searchbar">
                <input class="searchtext" type="text" dir="毕业相册" style="color: #777;" onfocus="if(this.value==this.getAttribute('dir')){this.value=''} this.style.color='#000'" onblur="if(this.value==''){this.value=this.getAttribute('dir')}this.style.color='#777'" value="毕业相册"/>
                <input type="button" value="搜索" class="searchbtn"/>
            </div>
            <div class="photoswitch">
                <ul class="photoswul">
                    <li class="swclickli" id="swclickli"><a href="#" onclick="photoswitch('total')">点击榜</a></li>
                    <li class="swnewli" id="swnewli"><a href="#" onclick="photoswitch('new')">新图榜</a></li>
                </ul>
            </div>
        </div>
        <div class="totalphoto" id="totalphoto">
            <div class="totaltitle">
                <span>点击榜</span>
            </div>
            <div class="photolist">
            	<%
            	//相册的前十
            	int k=1;
            	while(rsImageAlbum.next()){
            		String picId="tphoto"+k;
            		String nameId="tname"+k;
            		k++;
            		String albumname = rsImageAlbum.getString("AlbumName");
            		String userid = rsImageAlbum.getString("UserID");
            		String username =rsImageAlbum.getString("UserName");
            		String school = rsImageAlbum.getString("CollegeName");
            		String clicktimes = rsImageAlbum.getString("ClickTimes");
            		String description = rsImageAlbum.getString("AlbumDescription");
            		ResultSet rsImage=sql.executeQuery("select * from Images where UploaderID="+userid+" and PhotoAlbumName='"+albumname+"'"); 
            		%>
            	<div class="photoshow">
                    <div class="imageshow" id="<%=picId %>">
                        <%if(rsImage.next()){%>
							<a href="../PersonImage/ShowImages.jsp?album=<%=albumname %>&userid=<%=userid  %> "><img alt="<%=rsImage.getString("UserImageName") %>" src="/Bys-Website/USERS/<%=userid %>/Images/Thumbnail/<%=rsImage.getString("ServerImageName") %>" width="150px" height="120px"></a>
							<%}else{%>
							<a href="../PersonImage/ShowImages.jsp?album=<%=albumname %>&userid=<%=userid  %>"><img alt="hahah" src="/Bys-Website/SourceImageFile/q.jpg" width="150px" height="120px"></a>
							<%}%>
                        <div class="photoname" id="<%=nameId %>">
                            <div class="namedetail"><%=description %></div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/<%=username %></li>
                        <li>来自/<%=school %></li>
                        <li>点击量/<%=clicktimes %></li>
                    </ul>
                    </div>
                </div>
            	<%}
            	sql.closeConnection(); %>
            </div>
        </div>
        <div class="newphoto" id="newphoto">
            <div class="totaltitle">
                <span>新图榜</span>
            </div>
            <div class="photolist">
                <div class="photoshow">
                    <div class="imageshow" id="nphoto8">
                        <img src="/Bys-Website/SourceImageFile/photo8.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname8">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
                <div class="photoshow">
                    <div class="imageshow" id="nphoto7">
                        <img src="/Bys-Website/SourceImageFile/photo7.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname7">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
                <div class="photoshow">
                    <div class="imageshow" id="nphoto6">
                        <img src="/Bys-Website/SourceImageFile/photo6.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname6">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
                <div class="photoshow">
                    <div class="imageshow" id="nphoto5">
                        <img src="/Bys-Website/SourceImageFile/photo5.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname5">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
                <div class="photoshow">
                    <div class="imageshow" id="nphoto4">
                        <img src="/Bys-Website/SourceImageFile/photo4.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname4">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
                <div class="photoshow">
                    <div class="imageshow" id="nphoto3">
                        <img src="/Bys-Website/SourceImageFile/photo3.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname3">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
                <div class="photoshow">
                    <div class="imageshow" id="nphoto2">
                        <img src="/Bys-Website/SourceImageFile/photo2.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname2">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
                <div class="photoshow">
                    <div class="imageshow" id="nphoto1">
                        <img src="/Bys-Website/SourceImageFile/photo1.jpg" onclick="sAlert(this)"/>
                        <div class="photoname" id="nname1">
                            <div class="namedetail">
                                照片名称
                            </div>
                        </div>
                    </div>
                    <div class="photoinfo">
                    <ul>
                        <li>发布人/许诺</li>
                        <li>来自/电子科技大学</li>
                        <li>点击量/12345</li>
                    </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>    
        createMain();
    </script>
    <div class="topbar">
        <div class="logo">
			<a href="/Bys-Website/Public/home.jsp">
            	<img src="/Bys-Website/SourceImageFile/toplogo.jpg"/>
            </a>
        </div>
        <div class="navi">
            <ul class="naviul">
                <li><a href="/Bys-Website/Public/Video.jsp" class="outli">视频</a></li>
				<li><a href="/Bys-Website/Public/Photo.jsp" class="inli">相册</a></li>
				<li><a href="/Bys-Website/Public/Blog.jsp" class="outli">博客</a></li>
            </ul>
        </div>
        <div class="loginfo">
            <ul class="loginfoul">
            	<% if(session.getAttribute("pid")==null){%>
                <li><a href="/Bys-Website/Log_in.jsp">登录</a></li>
                <li><a href="/Bys-Website/Regist.jsp">注册</a></li>
                <%}else{
					String userID = session.getAttribute("pid").toString();%>
					<li><a href="/Bys-Website/PersonMainPage.jsp?userID=<%= userID %>"><%=session.getAttribute("username") %></a></li>     
					<li><a href="../LoginServlet?method=1">退出</a></li>
				<%}%> 
            </ul>
        </div>
    </div>
</body>
</html>